<!--
 * @Author: ChunLai
 * @Date: 2022-01-04 09:40:49
 * @LastEditTime: 2025-09-04 17:12:55
 * @Description: 公共页
 * @FilePath: \02.bldinsure\src\views\prenotice\simple\FuXing.vue
-->
<template>
  <div class="healthy-wrap" v-if="pageLoad">
    <TipMsg
      msg="为保证投保人与被保险人的保险权益在理赔时不受影响，投保本产品前，投保人应确认被保险人是否存在以下情形："
    ></TipMsg>
    <div class="md-title" v-if="noticeLen > 1">
      <span
        class="title-span font3"
        :class="{
          active: idx === activeIndex,
          'len1-width': pageData.length == 1,
        }"
        v-for="(unit, idx) in pageData"
        :key="idx"
        @click="changeMd(idx)"
      >
        {{
          `${unit.userType == "bbr" ? "被保险人" : "投保人"}${unit.moduleName}`
        }}
      </span>
    </div>
    <div class="modules" v-if="pageData.length > 0">
      <ul class="module-ul">
        <li
          class="module-li"
          v-for="(que, idx) in noticeObj.questionsList"
          :key="`que-${idx}`"
        >
          <div class="li-label">
            {{ que.impartContent }}
          </div>
          <template v-if="que.sedLists && que.sedLists.length > 0">
            <p
              class="sed-li"
              v-for="(sed, i) in que.sedLists"
              :key="`sed-${i}`"
              v-html="sed.cont"
            ></p>
          </template>
        </li>
      </ul>
    </div>
    <div class="health-statement">
      <p><b>特别提示</b></p>
      <br />
      <p>根据《保险法》第十六条规定：</p>
      <br />
      <p>
        订立保险合同，保险公司就保险标的或者被保险人的有关情况提出询问的，<b>投保人应当如实告知</b>。投保人故意或者因重大过失未履行前款规定的如实告知义务，足以影响保险公司决定是否同意承保或者提高保险费率的，保险公司有权解除合同。
      </p>
      <br />
      <p>
        投保人故意不履行如实告知义务的，保险公司对于合同解除前发生的保险事故，<b>不承担赔偿或者给付保险金的责任，并不退还保险费</b>。
      </p>
      <br />
      <p>
        投保人因重大过失未履行如实告知义务，对保险事故的发生有严重影响的，保险公司对于合同解除前发生的保险事故，<b>不承担赔偿或者给付保险金的责任，但应当退还退还保险费</b>。
      </p>
      <br />
      <p>
        如被保险人健康状况与告知内容不符，保险公司有权依据法律规定做出相应处理。
      </p>
      <br />
    </div>
    <SureBtns
      :utype="noticeObj.userType"
      @saveField="leftBtnHandle"
      @saveForm="rightBtnHandle"
    />
  </div>
</template>

<script>
import SureBtns from "./SureBtns";
import { simpleMixin } from "./mixin.js";
import { rebackUrlPath } from "@/methods/format.js";
export default {
  name: "FuXingSimple",
  data() {
    return {
      pageLoad: true,
    };
  },
  components: { SureBtns },
  computed: {},
  mixins: [simpleMixin],
  created() {
    this.initPageDatas();
  },
  mounted() {},
  methods: {
    leftBtnHandle() {
      if (this.noticeObj.userType == "tbr") {
        this.$dialog.alert({
          title: `投保人健康告知不通过`,
          message:
            "不能进行投保。您可取消附加投保人豁免选项，则不用进行投保人健康告知",
          confirmButtonColor: "#DA251E",
          confirmButtonText: "确认",
        });
      } else {
        if (this.bbrAutoHealthApi == "1") {
          this.$dialog
            .confirm({
              title: `被保险人健康告知不通过`,
              message:
                "本保障产品支持被保险人智能核保，如有健康告知所述疾病或状况，请进行智能核保，在线实时审核是否可继续投保",
              confirmButtonColor: "#DA251E",
              confirmButtonText: "智能核保",
            })
            .then(() => {
              this.toSmartHealthy();
            })
            .catch(() => {});
        } else {
          this.$dialog.alert({
            title: `被保险人健康告知不通过`,
            message: "不能进行投保",
            confirmButtonColor: "#DA251E",
            confirmButtonText: "确认",
          });
        }
      }
    },
    rightBtnHandle() {
      if (this.activeIndex < this.noticeLen - 1) {
        this.activeIndex += 1;
        window.scrollTo(0, 0);
      } else {
        this.$router.push("/form");
      }
    },
    toSmartHealthy() {
      const winVal = window.location.hash,
        whash = winVal.split("?");
      let params = {
        ...this.apiComParams,
        addRiskCode: "",
        successUrl: `${rebackUrlPath("#/form")}`,
        failUrl: `${rebackUrlPath(`${whash[0]}`)}`,
      };
      this.$store.commit("insert/UPDATE_PAYINFO", {
        addRiskCode: "",
      });
      // 豁免险种
      const has_hm = this.showedRisks.filter(
        (ele) => ele.productName.indexOf("豁免") !== -1
      );
      // console.log(has_hm);
      if (has_hm.length > 0) {
        let hmCodes = has_hm.map((hm) => hm.productCode || hm.varietyCode);
        if (hmCodes.length > 0) {
          params.addRiskCode = hmCodes.join("-");
          this.$store.commit("insert/UPDATE_PAYINFO", {
            addRiskCode: params.addRiskCode,
          });
        }
      }
      this.$store
        .dispatch("apis/comAdminApiRequest", {
          apiParams: params,
          apiName: "getHealthNoticeUrl",
          toast: true,
        })
        .then((data) => {
          if (data.url) {
            window.location.href = data.url;
          }
        });
    },
  },
};
</script>

<style lang="less" scoped>
@import "../../healthy/simple/style.less";
.health-statement {
  font-size: 14px;
  padding: 10px 15px;
  color: #e6a23c;
  background: #fdfcec;
}
.healthy-wrap {
  padding-bottom: 0;
}
</style>
